/**
 * Created by cc
 * Description:
 * User: CZH
 * Date: 2022-09-15
 * Time: 19:48
 */
class Calculator{
    private int num1;
    private int num2;

    public Calculator(){ }
    public Calculator(int num1, int num2){
        this.num1 = num1;
        this.num2 = num2;
    }

    public int getNum1() {
        return num1;
    }

    public void setNum1(int num1) {
        this.num1 = num1;
    }

    public int getNum2() {
        return num2;
    }

    public void setNum2(int num2) {
        this.num2 = num2;
    }

    @Override
    public String toString() {
        return "Calculator{" +
                "num1=" + num1 +
                ", num2=" + num2 +
                '}';
    }
    public int add(){
        return getNum1() + getNum2();
    }
    public int min(){
        return getNum1() - getNum2();
    }
    public int mul(){
        return getNum1() * getNum2();
    }
    public double exc(){
        return 1.0 * getNum1() / getNum2();
    }
}
public class HomeWork1 {
    //编写一个类Calculator,有两个属性num1,num2,
    // 这两个数据的值，不能在定义的同时初始化，最后实现加减乘除四种运算
    public static void main(String[] args) {
        Calculator c1 = new Calculator();
        c1.setNum1(10);
        c1.setNum2(20);
        System.out.println(c1.add());
        System.out.println(c1.min());
        System.out.println(c1.mul());
        System.out.println(c1.exc());
    }
}
